package in.muton.edushare.jobs;

import in.muton.edushare.components.tasks.electives.allotment.ChangeSem;

import java.util.List;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.wicket.model.Model;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;

import com.edushare.common.dao.UniversitiesDAO;
import com.edushare.common.orm.ORMInterface;
import com.edushare.common.vo.Universities;

public class SemesterChangeJob  implements EduShareJob {
	public static final Log log = LogFactory.getLog(SemesterChangeJob.class);

	public void execute(JobExecutionContext arg0) throws JobExecutionException {
		ORMInterface orm = ElectiveAssignJob.getORMInterface();
		List<Universities> univList = new UniversitiesDAO(orm)
			.getAllUniversities();
		log.debug("Semester change job: execute");
		
		for (Universities univ : univList) {
			log.debug("University = "+ univ.getName());
			new ChangeSem(new Model<Universities>(univ)).changeSemUserCommand(orm);
		}
	}
}
